package com.briup.corejava.day05;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * java.util.Arrays工具类的使用
 * 只要是方便了数组的部分操作输出、排序、赋值、查找等等
 */
public class Test7 {
    public static void main(String[] args) {
        String[] strs = {"Java","C","Python"};
        int[] arr = {4,2,6,3,7,12,57};
        // 字符串类型的输出
        System.out.println(Arrays.toString(strs));

        // 数组复制
        String[] copyStrs = new String[strs.length*2];
        String[] newStrs = Arrays.copyOf(strs, strs.length * 2);
        System.out.println(Arrays.toString(newStrs));

        // 数组的填充
        Arrays.fill(copyStrs,"17:00");
        System.out.println(Arrays.toString(copyStrs));

        // 排序
        Arrays.sort(strs);
        System.out.println(Arrays.toString(strs));

        // 二分查找
        int index = Arrays.binarySearch(arr, 7);
        System.out.println(index);
    }
}
